using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


/// <summary>
/// Summary description for AdRotatorHelper
/// </summary>
public partial class ControlHelper
{
    public int FillDataTableToAdRotator(
    AdRotator adRotator)
    {
        int totalRecord = 0;
        DataTable dataTable =
        sqlServerProvider.GetDataTable();
        if (dataTable != null)
        {
            adRotator.DataSource = dataTable;            
            totalRecord = dataTable.Rows.Count;
        }
        else
            adRotator.DataSource = null;
        adRotator.DataBind();
        return totalRecord;
    }
    
    public int FillDataTableToAdRotator(
    AdRotator adRotator, string imageUrlField,
    string navigateUrlField, 
    string alternateTextField)
    {
        int totalRecord = 0;
        DataTable dataTable =
        sqlServerProvider.GetDataTable();
        if (dataTable != null)
        {
            adRotator.DataSource = dataTable;
            adRotator.ImageUrlField = imageUrlField;
            adRotator.NavigateUrlField = navigateUrlField;
            adRotator.AlternateTextField = alternateTextField;            
            totalRecord = dataTable.Rows.Count;
        }
        else
            adRotator.DataSource = null;
        adRotator.DataBind();
        return totalRecord;
    }
    
    public void FillXmlToAdRotator(
    AdRotator adRotator, string xmlFile)
    {               
        if (xmlFile != null)
        {
            adRotator.AdvertisementFile = xmlFile;
             
        }         
        
    }
}
